﻿@using SCMS.Resource
@model SCMS.UI.Models.EditAsset
@using SCMS.CoreBusinessLogic.Settings
@{AjaxOptions ajaxOpts = new AjaxOptions
  {
      UpdateTargetId = "popup-page",
      LoadingElementId = "popup-loading",
      HttpMethod = "Post",
      Url = Url.Action("EditAssetDetails"),
      OnBegin = string.Format("WaitForFineUploader('uploadMsg');ShowDialogue('{0}');", Resources.Inventory_LoadEditAsset_ItemDetails),
      OnSuccess = "CenterPopup();"
  };}
<script src="@Url.Content("~/Scripts/js/jquery-1.7.2.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/js/jquery.autocomplete.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@using (Ajax.BeginForm(null, null, ajaxOpts, new { @class = "form", enctype = "multipart/form-data" }))
{
    @Html.ValidationSummary(true)
    @Html.HiddenFor(x => x.EntityAsset.Id)
    @Html.HiddenFor(x => x.EntityAsset.CountryProgramId)
    @Html.HiddenFor(x => x.EntityAsset.ItemId)
    @Html.HiddenFor(x => x.EntityAsset.GoodsReceivedNoteItemId)
    @Html.HiddenFor(x => x.EntityAsset.DepreciationCurrencyId)
    @Html.HiddenFor(x => x.EntityAsset.AcquisionDate)
    @Html.HiddenFor(x => x.EntityAsset.OriginalProjectId)
    @Html.HiddenFor(x => x.EntityAsset.CurrentProjectDonorId)
     
    <table width="600px" align="center" cellpadding="2">
        <tr class="gridheader2">
            <td align="center" width="33.3%">
                @Resources_morgan.GoodsReceivedNote_LoadTransferAsset_CurrentProPatnar
            </td>
            <td align="center" width="33.3%">
                @Resources.Global_String_AssetNo
            </td>
            <td align="center" width="33.3%">
                @Resources.Global_String_SerialNo
            </td>
        </tr>
        <tr>
            <td align="center" valign="top">
                
                @ViewBag.CurrentProject
                @* @Html.DropDownListFor(x => x.EntityAsset.CurrentProjectDonorId, Model.Projects, Resources.Global_String_PleaseSelect)
                @Html.ValidationMessageFor(x => x.EntityAsset.CurrentProjectDonorId)*@
            </td>
            <td align="center" valign="top">
                @Html.TextBoxFor(x => x.EntityAsset.AssetNumber, new { @readonly = "readonly", id = "refNo" })
                @Html.ValidationMessageFor(x => x.EntityAsset.AssetNumber, Resources.Global_String_Required)
            </td>
            <td align="center" valign="top">
                @Html.EditorFor(x => x.EntityAsset.SerialNumber)
                @Html.ValidationMessageFor(x => x.EntityAsset.SerialNumber, Resources.Global_String_Required)
            </td>
        </tr>
        <tr class="gridheader2">
            <td align="center" width="33.3%">
                @Resources.Inventory_AssetInventoryPopup_AssignedTo
            </td>
            <td align="center" width="33.3%">
                @Resources.Global_String_AssetDescription
            </td>
            <td align="center" width="33.3%">
                @Resources.Global_String_Weight
            </td>
        </tr>
        <tr>
            <td align="center" valign="top">
                @Html.DropDownListFor(x => x.EntityAsset.CurrentOwnerId, Model.Staffs, Resources.Global_String_PleaseSelect)
                @Html.ValidationMessageFor(x => x.EntityAsset.CurrentOwnerId)
            </td>
            <td align="center" valign="top">
                @Html.TextAreaFor(x => x.EntityAsset.Name, new { id = "AssetDessc", name = "AssetDessc" })
                @Html.ValidationMessageFor(x => x.EntityAsset.Name, Resources.Global_String_Required)
                <script type="text/javascript">
                    var $jq = jQuery.noConflict();
                    $jq("#AssetDessc").autocomplete("/GoodsReceivedNote/SearchAssetDesc");
                </script>
            </td>
            <td align="center" valign="top">
                @Html.TextBoxFor(x => x.EntityAsset.Weight, new { id = "txtweight", @class = "numericTb" })
                @Html.ValidationMessageFor(x => x.EntityAsset.Weight, Resources.Global_String_Required)
            </td>
        </tr>
        <tr class="gridheader2">
            <td align="center" width="33.3%">
                @Resources.GoodsReceivedNote_LoadOtherAssets_PurchasePrice
            </td>
            <td align="center" width="33.3%">
                @Resources.Global_String_EstLifespan
            </td>
            <td align="center" width="33.3%">
                @Resources.Global_String_UseEstLifespan
            </td>
        </tr>
        <tr>
            <td align="center" valign="top">
                @Html.TextBoxFor(x => x.EntityAsset.PurchaseValue, new { @disabled = "disabled", @class = "numericTb", id = "purcahseValue" })
                @Html.ValidationMessageFor(x => x.EntityAsset.PurchaseValue, Resources.Global_String_Required)
            </td>
            <td align="center" valign="top">
                @Html.TextBoxFor(x => x.EntityAsset.Lifespan, new { @class = "numericTb" })
                @Html.ValidationMessageFor(x => x.EntityAsset.Lifespan, Resources.Global_String_Required)
            </td>
            <td align="center" valign="top">
                @Html.CheckBoxFor(x => x.EntityAsset.UseLifeSpan)
            </td>
        </tr>
        <tr class="gridheader2">
            <td align="center" width="33.3%">
                @Resources.GoodsReceivedNote_LoadOtherAssets_DepreciationType
            </td>
            <td align="center" width="33.3%">
                @Resources.GoodsReceivedNote_LoadOtherAssets_PercentageDep
            </td>
            <td align="center" width="33.3%">
                @Resources.GoodsReceivedNote_GRAssetList_SalvageValue
            </td>
        </tr>
        <tr>
            <td align="center" valign="top">
                @Html.DropDownListFor(x => x.EntityAsset.DepreciationType, new SelectList(
                new List<Object>{ 
                    new { value = "Straight Line" , text = Resources.Global_DepreciationType_StraightLine  },
                    new { value = "Reducing Balance" , text = Resources.Global_DepreciationType_ReducingBalance },
                    new { value = "Zero Percentage" , text = Resources.Global_DepreciationType_ZeroBalance}
                }, "value", "text"), Resources.Global_String_PleaseSelect)
                @Html.ValidationMessageFor(x => x.EntityAsset.DepreciationType)
            </td>
            <td align="center" valign="top">
                @Html.TextBoxFor(x => x.EntityAsset.PercentageDepr, new { @class = "numericTb" })
                @Html.ValidationMessageFor(x => x.EntityAsset.PercentageDepr, Resources.Global_String_Required)
            </td>
            <td align="center" valign="top">
                @Html.TextBoxFor(x => x.EntityAsset.SalvageValue, new { id = "txtsalvageValue", @class = "numericTb", onblur = "javascript:ValidateSalvageValue(this);" })
                @Html.ValidationMessageFor(x => x.EntityAsset.SalvageValue, Resources.Global_String_Required)
            </td>
        </tr>
        <tr class="gridheader2">
            <td align="center" width="33.3%">
                @Resources.GoodsReceivedNote_LoadRegisterAsset_OpeningAccDep
            </td>
            <td align="center" width="33.3%">
                @Resources.Global_String_Warehouse
            </td>
            <td align="center" width="33.3%">
                @Resources.GoodsReceivedNote_LoadOtherAssets_IsFleet
            </td>
        </tr>
        <tr>
            <td align="center" valign="top">
                @Html.TextBoxFor(x => x.EntityAsset.OpeningAccDepreciaiton, new { @class = "numericTb" })
                @Html.ValidationMessageFor(x => x.EntityAsset.OpeningAccDepreciaiton, Resources.Global_String_Required)
            </td>
            <td align="center" valign="top">
                @Html.DropDownListFor(x => x.EntityAsset.CurrentWareHouseId, Model.Warehouses, Resources.Global_String_PleaseSelect)
                @Html.ValidationMessageFor(x => x.EntityAsset.CurrentWareHouseId, Resources.Global_String_Required)
            </td>
            <td align="center" valign="top">@Html.EditorFor(x => x.EntityAsset.IsFleet)
                @Html.ValidationMessageFor(x => x.EntityAsset.IsFleet)
            </td>
        </tr>
        <tr class="gridheader2">
            <td align="center" width="33.3%">
                @Resources.Global_String_Image
            </td>
            <td align="center" width="33.3%">
                &nbsp;
            </td>
            <td align="center" width="33.3%">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td align="center" width="33.3%">
                <div id="fineUploaderElementId">
                    <noscript>
                        <p>@Resources.Global_String_NoJavascriptMessage</p>
                    </noscript>
                </div>
            </td>
            <td align="center" width="33.3%" id="uploadMsg">
            </td>
            <td align="right">
                <input type="submit" class="btn green" value="@Resources.Global_String_SaveChanges" />
            </td>
        </tr>
    </table>
}
